/***********************************************************************************************************************************
 *    Name: Alerts.sql
 *  Author: Frank Figearo — http://www.sqlnerd.me/ — frank@sqlnerd.me
 * Summary: 
**/
USE msdb;

/*
Error 825: Read Retry
Severity 17: Insufficient Resources
Severity 18: Nonfatal Internal Error Detected
Severity 19: SQL Server Error in Resource
Severity 20: SQL Server Fatal Error in Current Process
Severity 21: SQL Server Fatal Error in Database (dbid) Processes
Severity 22: SQL Server Fatal Error Table Integrity Suspect
Severity 23: SQL Server Fatal Error: Database Integrity Suspect
Severity 24: Hardware Error

	EXECUTE dbo.sp_delete_alert @name= N'Severity 19 Error';
	EXECUTE dbo.sp_delete_alert @name= N'Severity 20 Error';
	EXECUTE dbo.sp_delete_alert @name= N'Severity 21 Error';
	EXECUTE dbo.sp_delete_alert @name= N'Severity 22 Error';
	EXECUTE dbo.sp_delete_alert @name= N'Severity 23 Error';
	EXECUTE dbo.sp_delete_alert @name= N'Severity 24 Error';
	EXECUTE dbo.sp_delete_alert @name= N'Severity 25 Error';
	EXECUTE dbo.sp_delete_alert @name= N'Error 825';
**/

EXECUTE dbo.sp_add_alert @name= N'Severity 19 Error', @message_id= 0, @severity= 19, @include_event_description_in= 1;
EXECUTE dbo.sp_add_notification @alert_name= N'Severity 19 Error', @operator_name= N'(DB)A-Team', @notification_method= 1;

EXECUTE dbo.sp_add_alert @name= N'Severity 20 Error', @message_id= 0, @severity= 20, @include_event_description_in= 1;
EXECUTE dbo.sp_add_notification @alert_name= N'Severity 20 Error', @operator_name= N'(DB)A-Team', @notification_method= 1;

EXECUTE dbo.sp_add_alert @name= N'Severity 21 Error', @message_id= 0, @severity= 21, @include_event_description_in= 1;
EXECUTE dbo.sp_add_notification @alert_name= N'Severity 21 Error', @operator_name= N'(DB)A-Team', @notification_method= 1;

EXECUTE dbo.sp_add_alert @name= N'Severity 22 Error', @message_id= 0, @severity= 22, @include_event_description_in= 1;
EXECUTE dbo.sp_add_notification @alert_name= N'Severity 22 Error', @operator_name= N'(DB)A-Team', @notification_method= 1;

EXECUTE dbo.sp_add_alert @name= N'Severity 23 Error', @message_id= 0, @severity= 23, @include_event_description_in= 1;
EXECUTE dbo.sp_add_notification @alert_name= N'Severity 23 Error', @operator_name= N'(DB)A-Team', @notification_method= 1;

EXECUTE dbo.sp_add_alert @name= N'Severity 24 Error', @message_id= 0, @severity= 24, @include_event_description_in= 1;
EXECUTE dbo.sp_add_notification @alert_name= N'Severity 24 Error', @operator_name= N'(DB)A-Team', @notification_method= 1;

EXECUTE dbo.sp_add_alert @name= N'Severity 25 Error', @message_id= 0, @severity= 25, @include_event_description_in= 1;
EXECUTE dbo.sp_add_notification @alert_name= N'Severity 25 Error', @operator_name= N'(DB)A-Team', @notification_method= 1;

EXECUTE dbo.sp_add_alert @name= N'Error 825', @message_id= 825, @severity= 0, @include_event_description_in= 1;
EXECUTE dbo.sp_add_notification @alert_name= N'Error 825', @operator_name= N'(DB)A-Team', @notification_method= 1;

GO